var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2ADManager = require("ADManager");
var $2pvzChannel = require("pvzChannel");
var $2BundleManager = require("BundleManager");
var $2PlantMgr = require("PlantMgr");
var $2UIManager = require("UIManager");
var $2UserDataManager = require("UserDataManager");
var $2TaSdk = require("TaSdk");
var $2MyUtils = require("MyUtils");
var $2RewardUI = require("RewardUI");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_TryPanelUI = /* */function (_cc$Component77) {
  babel_inherits(f, _cc$Component77);
  var _super93 = babel_createSuper(f);
  function f() {
    var _this214;
    babel_classCallCheck(this, f);
    _this214 = _super93.apply(this, arguments);
    _this214.rewardPanel = null;
    return _this214;
  }
  babel_createClass(f, [{
    key: "init",
    value: function init(e) {
      this.plantArr = e;
      this.initPlantPanel();
      this.initPlatform();
      $2TaSdk.default.instance.AdsExposure($2TaSdk.VideoIndex.getPlant);
    }
  }, {
    key: "initPlatform",
    value: function initPlatform() {
      switch ($2ADManager.default.instance.sdkType) {
        case $2ADManager.SDK_TYPE.Byte:
          this.node.getChildByName("Bg").getChildByName("Close1").active = false;
          this.node.getChildByName("Bg").getChildByName("Close2").active = true;
      }
    }
  }, {
    key: "initPlantPanel",
    value: function initPlantPanel() {
      this.plant1ID = $2MyUtils.MyUtils.getArrRandomValue(this.plantArr);
      var e = $2PlantMgr.default.instance().getPlant(this.plant1ID);
      this.rewardPanel.children[0].getChildByName("Plant").getComponent(sp.Skeleton).skeletonData = $2BundleManager.default.instance.getBundleRes("Spine", "plant/" + e.dragonName + "/" + e.dragonName, sp.SkeletonData);
      this.rewardPanel.children[0].getChildByName("Plant").getComponent(sp.Skeleton).setAnimation(0, "daiji", true);
    }
  }, {
    key: "onClickVideoBtn",
    value: function onClickVideoBtn(e, t) {
      var _this215 = this;
      $2pvzChannel.pvzChannel.instance().showVideo({
        sucCall() {
          var a = [{
            rewardType: "b",
            rare: 1,
            number: 1,
            plantID: 1
          }];
          if ("1" == t) {
            a[0].rare = $2PlantMgr.default.instance().getPlant(_this215.plant1ID).rare;
            a[0].plantID = _this215.plant1ID;
            $2UserDataManager.default.instance.getPlant(_this215.plant1ID);
          } else {
            a[0].rare = $2PlantMgr.default.instance().getPlant(_this215.plant2ID).rare;
            $2UserDataManager.default.instance.getPlant(_this215.plant2ID);
            a[0].plantID = _this215.plant2ID;
          }
          e.currentTarget.getComponent(cc.Button).interactable = false;
          $2UserDataManager.default.instance.freePlant++;
          $2UIManager.default.instance.openUI("RewardUI", 40).getComponent($2RewardUI.default).init(a);
          _this215.onClickCloseBtn();
        },
        failCall() {},
        endCall() {}
      });
    }
  }, {
    key: "onClickCloseBtn",
    value: function onClickCloseBtn() {
      $2UIManager.default.instance.closeUI("TryPanelUI");
    }
  }]);
  return f;
}(cc.Component);
cc__decorate([ccp_property(cc.Node)], def_TryPanelUI.prototype, "rewardPanel", undefined);
def_TryPanelUI = cc__decorate([ccp_ccclass], def_TryPanelUI);
exports.default = def_TryPanelUI;